package com.ityedao.IO序列化流;

import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;

public class MutObjectInputStream {
    public static void main(String[] args) {
        try (
                ObjectInputStream ois =
                        new ObjectInputStream(
                                new FileInputStream("src\\IO流-序列化多个对象.txt"))
        ) {
            List<User> users = new ArrayList<>();
            users = (List<User>) ois.readObject();
            for (User user : users) {
                System.out.println(user);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
